<?php
/**
 * @link http://www.yiiframework.com/
 * @copyright Copyright (c) 2008 Yii Software LLC
 * @license http://www.yiiframework.com/license/
 */

namespace app\commands;
use Yii;

use yii\console\Controller;

/**
 * This command echoes the first argument that you have entered.
 *
 * This command is provided as an example for you to learn how to create console commands.
 *
 * @author Qiang Xue <qiang.xue@gmail.com>
 * @since 2.0
 */
class HelloController extends Controller
{
    /**
     * This command echoes what you have entered as the message.
     * @param string $message the message to be echoed.
     */
    public function actionIndex($message = 'hello world')
    {
        echo $message . "\n";
    }

    public function actionInsert(){

        for ($i = 2; $i <= 30; $i++) {
            $sql =  "INSERT INTO `user` VALUES ('{$i}', '6955044{$i}@qq.com', 'e10adc3949ba59abbe56e057f20f883e', '学员', '风清扬', '445281198611241877', 'male', '1986-11-08', '广州', '18170291331', '6955044', '广州学并思教育咨询有限公司', '负责人', 'C1501', 'C15010{$i}', 'zhibin86@sina.com', '我是一个简单得不行的人', '0', '', '', '0');
";
            Yii::$app->db->createCommand($sql)->execute();
        }

        //echo $str;
    }
    public function actionSql(){
        $sql="
        CREATE TABLE `class` (
          `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
          `class` varchar(255) NOT NULL DEFAULT '' COMMENT '班级',
          `comments` varchar(1000) DEFAULT NULL,
          PRIMARY KEY (`id`),
          UNIQUE KEY `class` (`class`),
        ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='vip班级表';
        ";
    }
}

